<?php
namespace api\common\model;
use think\Db;
class OrderExtra extends \think\Model 
{
    protected $autoWriteTimestamp = true;
    protected $table = 'order_extra';//预约表

    /**
     * 预约
     */
    public function addOrderExtra($data){
        $res = false;
        $date = getNowDate();
        $data['orderId'] = $data['orderId'];
        $data['addTime'] = $date;//添加时间
        $data['updTime'] = $date;//修改时间
        $data['orderTime'] = $data['orderTime'];
        $data['orderName'] = $data['orderName'];
        $data['orderPhone'] = $data['orderPhone'];
        $data['orderAddress'] = $data['orderAddress'];
        $insert = Db::name($this->table)->insert($data);
        if($insert){
            $res = true;
        }
        return $res;
    }


    /**
     * 根据订单id修改预约信息
     */
    public function updInfo($data){
        $res = false;
        $date = getNowDate();
        $data['updTime'] = $date;//修改时间
        $update = Db::name($this->table)->where('orderId',$data['orderId'])->update($data);
        if($update){
            $res = true;
        }
        return $res;
    }
    
}
